/**
 * AlumnoCarrera.java
 *
 * Fecha de creación: Apr 23, 2012,5:47:06 PM
 *
 * Autor: José Ignacio Rivero Dávila
 */

package org.examat.entidades;

import java.io.Serializable;
import javax.persistence.*;


@Entity
@Table(name = "AlumnoCarrera")
@NamedQueries({
    @NamedQuery(name = "AlumnoCarrera.findAll", query = "SELECT a FROM AlumnoCarrera a"),
    @NamedQuery(name = "AlumnoCarrera.findByClaveUnicaAlumno", query = "SELECT a FROM AlumnoCarrera a WHERE a.alumnoCarreraPK.claveUnicaAlumno = :claveUnicaAlumno"),
    @NamedQuery(name = "AlumnoCarrera.findByClaveCarrera", query = "SELECT a FROM AlumnoCarrera a WHERE a.alumnoCarreraPK.claveCarrera = :claveCarrera")})
public class AlumnoCarrera implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected AlumnoCarreraPK alumnoCarreraPK;

    public AlumnoCarrera() {
    }

    public AlumnoCarrera(AlumnoCarreraPK alumnoCarreraPK) {
        this.alumnoCarreraPK = alumnoCarreraPK;
    }

    public AlumnoCarrera(int claveUnicaAlumno, String claveCarrera) {
        this.alumnoCarreraPK = new AlumnoCarreraPK(claveUnicaAlumno, claveCarrera);
    }

    public AlumnoCarreraPK getAlumnoCarreraPK() {
        return alumnoCarreraPK;
    }

    public void setAlumnoCarreraPK(AlumnoCarreraPK alumnoCarreraPK) {
        this.alumnoCarreraPK = alumnoCarreraPK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (alumnoCarreraPK != null ? alumnoCarreraPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AlumnoCarrera)) {
            return false;
        }
        AlumnoCarrera other = (AlumnoCarrera) object;
        if ((this.alumnoCarreraPK == null && other.alumnoCarreraPK != null) || (this.alumnoCarreraPK != null && !this.alumnoCarreraPK.equals(other.alumnoCarreraPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.examat.entidades.AlumnoCarrera[ alumnoCarreraPK=" + alumnoCarreraPK + " ]";
    }

}
